(0) Obligation:

Clauses:

p(X, X).
p(f(X), g(Y)) :- ','(p(f(X), f(Z)), p(Z, g(W))).

Query: p(g,a)

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph ICLP10.

(2) Obligation:

Clauses:

pA(T21, T21, X8) :- pB(T21, X8).
pB(g(T35), T35).
pB(f(T38), X37) :- pA(T38, X35, X36).
pC(T4, T4).
pC(f(T7), g(T8)) :- pA(T7, X7, X8).
pC(f(T57), g(T44)) :- pB(T57, X49).

Query: pC(g,a)

(3) PrologToPiTRSProof (SOUND transformation)

We use the technique of [TOCL09]. With regard to the inferred argument filtering the predicates were used in the following modes:
pC_in: (b,f)
pA_in: (b,f,f)
pB_in: (b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

pC_in_ga(T4, T4) → pC_out_ga(T4, T4)
pC_in_ga(f(T7), g(T8)) → U3_ga(T7, T8, pA_in_gaa(T7, X7, X8))
pA_in_gaa(T21, T21, X8) → U1_gaa(T21, X8, pB_in_ga(T21, X8))
pB_in_ga(g(T35), T35) → pB_out_ga(g(T35), T35)
pB_in_ga(f(T38), X37) → U2_ga(T38, X37, pA_in_gaa(T38, X35, X36))
U2_ga(T38, X37, pA_out_gaa(T38, X35, X36)) → pB_out_ga(f(T38), X37)
U1_gaa(T21, X8, pB_out_ga(T21, X8)) → pA_out_gaa(T21, T21, X8)
U3_ga(T7, T8, pA_out_gaa(T7, X7, X8)) → pC_out_ga(f(T7), g(T8))
pC_in_ga(f(T57), g(T44)) → U4_ga(T57, T44, pB_in_ga(T57, X49))
U4_ga(T57, T44, pB_out_ga(T57, X49)) → pC_out_ga(f(T57), g(T44))

The argument filtering Pi contains the following mapping:
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
pC_out_ga(x1, x2)  =  pC_out_ga(x2)
f(x1)  =  f(x1)
U3_ga(x1, x2, x3)  =  U3_ga(x3)
pA_in_gaa(x1, x2, x3)  =  pA_in_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
pB_in_ga(x1, x2)  =  pB_in_ga(x1)
g(x1)  =  g
pB_out_ga(x1, x2)  =  pB_out_ga
U2_ga(x1, x2, x3)  =  U2_ga(x3)
pA_out_gaa(x1, x2, x3)  =  pA_out_gaa(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

pC_in_ga(T4, T4) → pC_out_ga(T4, T4)
pC_in_ga(f(T7), g(T8)) → U3_ga(T7, T8, pA_in_gaa(T7, X7, X8))
pA_in_gaa(T21, T21, X8) → U1_gaa(T21, X8, pB_in_ga(T21, X8))
pB_in_ga(g(T35), T35) → pB_out_ga(g(T35), T35)
pB_in_ga(f(T38), X37) → U2_ga(T38, X37, pA_in_gaa(T38, X35, X36))
U2_ga(T38, X37, pA_out_gaa(T38, X35, X36)) → pB_out_ga(f(T38), X37)
U1_gaa(T21, X8, pB_out_ga(T21, X8)) → pA_out_gaa(T21, T21, X8)
U3_ga(T7, T8, pA_out_gaa(T7, X7, X8)) → pC_out_ga(f(T7), g(T8))
pC_in_ga(f(T57), g(T44)) → U4_ga(T57, T44, pB_in_ga(T57, X49))
U4_ga(T57, T44, pB_out_ga(T57, X49)) → pC_out_ga(f(T57), g(T44))

The argument filtering Pi contains the following mapping:
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
pC_out_ga(x1, x2)  =  pC_out_ga(x2)
f(x1)  =  f(x1)
U3_ga(x1, x2, x3)  =  U3_ga(x3)
pA_in_gaa(x1, x2, x3)  =  pA_in_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
pB_in_ga(x1, x2)  =  pB_in_ga(x1)
g(x1)  =  g
pB_out_ga(x1, x2)  =  pB_out_ga
U2_ga(x1, x2, x3)  =  U2_ga(x3)
pA_out_gaa(x1, x2, x3)  =  pA_out_gaa(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)

(5) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

PC_IN_GA(f(T7), g(T8)) → U3_GA(T7, T8, pA_in_gaa(T7, X7, X8))
PC_IN_GA(f(T7), g(T8)) → PA_IN_GAA(T7, X7, X8)
PA_IN_GAA(T21, T21, X8) → U1_GAA(T21, X8, pB_in_ga(T21, X8))
PA_IN_GAA(T21, T21, X8) → PB_IN_GA(T21, X8)
PB_IN_GA(f(T38), X37) → U2_GA(T38, X37, pA_in_gaa(T38, X35, X36))
PB_IN_GA(f(T38), X37) → PA_IN_GAA(T38, X35, X36)
PC_IN_GA(f(T57), g(T44)) → U4_GA(T57, T44, pB_in_ga(T57, X49))
PC_IN_GA(f(T57), g(T44)) → PB_IN_GA(T57, X49)

The TRS R consists of the following rules:

pC_in_ga(T4, T4) → pC_out_ga(T4, T4)
pC_in_ga(f(T7), g(T8)) → U3_ga(T7, T8, pA_in_gaa(T7, X7, X8))
pA_in_gaa(T21, T21, X8) → U1_gaa(T21, X8, pB_in_ga(T21, X8))
pB_in_ga(g(T35), T35) → pB_out_ga(g(T35), T35)
pB_in_ga(f(T38), X37) → U2_ga(T38, X37, pA_in_gaa(T38, X35, X36))
U2_ga(T38, X37, pA_out_gaa(T38, X35, X36)) → pB_out_ga(f(T38), X37)
U1_gaa(T21, X8, pB_out_ga(T21, X8)) → pA_out_gaa(T21, T21, X8)
U3_ga(T7, T8, pA_out_gaa(T7, X7, X8)) → pC_out_ga(f(T7), g(T8))
pC_in_ga(f(T57), g(T44)) → U4_ga(T57, T44, pB_in_ga(T57, X49))
U4_ga(T57, T44, pB_out_ga(T57, X49)) → pC_out_ga(f(T57), g(T44))

The argument filtering Pi contains the following mapping:
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
pC_out_ga(x1, x2)  =  pC_out_ga(x2)
f(x1)  =  f(x1)
U3_ga(x1, x2, x3)  =  U3_ga(x3)
pA_in_gaa(x1, x2, x3)  =  pA_in_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
pB_in_ga(x1, x2)  =  pB_in_ga(x1)
g(x1)  =  g
pB_out_ga(x1, x2)  =  pB_out_ga
U2_ga(x1, x2, x3)  =  U2_ga(x3)
pA_out_gaa(x1, x2, x3)  =  pA_out_gaa(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
PC_IN_GA(x1, x2)  =  PC_IN_GA(x1)
U3_GA(x1, x2, x3)  =  U3_GA(x3)
PA_IN_GAA(x1, x2, x3)  =  PA_IN_GAA(x1)
U1_GAA(x1, x2, x3)  =  U1_GAA(x1, x3)
PB_IN_GA(x1, x2)  =  PB_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x3)
U4_GA(x1, x2, x3)  =  U4_GA(x3)

We have to consider all (P,R,Pi)-chains

(6) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

PC_IN_GA(f(T7), g(T8)) → U3_GA(T7, T8, pA_in_gaa(T7, X7, X8))
PC_IN_GA(f(T7), g(T8)) → PA_IN_GAA(T7, X7, X8)
PA_IN_GAA(T21, T21, X8) → U1_GAA(T21, X8, pB_in_ga(T21, X8))
PA_IN_GAA(T21, T21, X8) → PB_IN_GA(T21, X8)
PB_IN_GA(f(T38), X37) → U2_GA(T38, X37, pA_in_gaa(T38, X35, X36))
PB_IN_GA(f(T38), X37) → PA_IN_GAA(T38, X35, X36)
PC_IN_GA(f(T57), g(T44)) → U4_GA(T57, T44, pB_in_ga(T57, X49))
PC_IN_GA(f(T57), g(T44)) → PB_IN_GA(T57, X49)

The TRS R consists of the following rules:

pC_in_ga(T4, T4) → pC_out_ga(T4, T4)
pC_in_ga(f(T7), g(T8)) → U3_ga(T7, T8, pA_in_gaa(T7, X7, X8))
pA_in_gaa(T21, T21, X8) → U1_gaa(T21, X8, pB_in_ga(T21, X8))
pB_in_ga(g(T35), T35) → pB_out_ga(g(T35), T35)
pB_in_ga(f(T38), X37) → U2_ga(T38, X37, pA_in_gaa(T38, X35, X36))
U2_ga(T38, X37, pA_out_gaa(T38, X35, X36)) → pB_out_ga(f(T38), X37)
U1_gaa(T21, X8, pB_out_ga(T21, X8)) → pA_out_gaa(T21, T21, X8)
U3_ga(T7, T8, pA_out_gaa(T7, X7, X8)) → pC_out_ga(f(T7), g(T8))
pC_in_ga(f(T57), g(T44)) → U4_ga(T57, T44, pB_in_ga(T57, X49))
U4_ga(T57, T44, pB_out_ga(T57, X49)) → pC_out_ga(f(T57), g(T44))

The argument filtering Pi contains the following mapping:
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
pC_out_ga(x1, x2)  =  pC_out_ga(x2)
f(x1)  =  f(x1)
U3_ga(x1, x2, x3)  =  U3_ga(x3)
pA_in_gaa(x1, x2, x3)  =  pA_in_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
pB_in_ga(x1, x2)  =  pB_in_ga(x1)
g(x1)  =  g
pB_out_ga(x1, x2)  =  pB_out_ga
U2_ga(x1, x2, x3)  =  U2_ga(x3)
pA_out_gaa(x1, x2, x3)  =  pA_out_gaa(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
PC_IN_GA(x1, x2)  =  PC_IN_GA(x1)
U3_GA(x1, x2, x3)  =  U3_GA(x3)
PA_IN_GAA(x1, x2, x3)  =  PA_IN_GAA(x1)
U1_GAA(x1, x2, x3)  =  U1_GAA(x1, x3)
PB_IN_GA(x1, x2)  =  PB_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x3)
U4_GA(x1, x2, x3)  =  U4_GA(x3)

We have to consider all (P,R,Pi)-chains

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 6 less nodes.

(8) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

PA_IN_GAA(T21, T21, X8) → PB_IN_GA(T21, X8)
PB_IN_GA(f(T38), X37) → PA_IN_GAA(T38, X35, X36)

The TRS R consists of the following rules:

pC_in_ga(T4, T4) → pC_out_ga(T4, T4)
pC_in_ga(f(T7), g(T8)) → U3_ga(T7, T8, pA_in_gaa(T7, X7, X8))
pA_in_gaa(T21, T21, X8) → U1_gaa(T21, X8, pB_in_ga(T21, X8))
pB_in_ga(g(T35), T35) → pB_out_ga(g(T35), T35)
pB_in_ga(f(T38), X37) → U2_ga(T38, X37, pA_in_gaa(T38, X35, X36))
U2_ga(T38, X37, pA_out_gaa(T38, X35, X36)) → pB_out_ga(f(T38), X37)
U1_gaa(T21, X8, pB_out_ga(T21, X8)) → pA_out_gaa(T21, T21, X8)
U3_ga(T7, T8, pA_out_gaa(T7, X7, X8)) → pC_out_ga(f(T7), g(T8))
pC_in_ga(f(T57), g(T44)) → U4_ga(T57, T44, pB_in_ga(T57, X49))
U4_ga(T57, T44, pB_out_ga(T57, X49)) → pC_out_ga(f(T57), g(T44))

The argument filtering Pi contains the following mapping:
pC_in_ga(x1, x2)  =  pC_in_ga(x1)
pC_out_ga(x1, x2)  =  pC_out_ga(x2)
f(x1)  =  f(x1)
U3_ga(x1, x2, x3)  =  U3_ga(x3)
pA_in_gaa(x1, x2, x3)  =  pA_in_gaa(x1)
U1_gaa(x1, x2, x3)  =  U1_gaa(x1, x3)
pB_in_ga(x1, x2)  =  pB_in_ga(x1)
g(x1)  =  g
pB_out_ga(x1, x2)  =  pB_out_ga
U2_ga(x1, x2, x3)  =  U2_ga(x3)
pA_out_gaa(x1, x2, x3)  =  pA_out_gaa(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
PA_IN_GAA(x1, x2, x3)  =  PA_IN_GAA(x1)
PB_IN_GA(x1, x2)  =  PB_IN_GA(x1)

We have to consider all (P,R,Pi)-chains

(9) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(10) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

PA_IN_GAA(T21, T21, X8) → PB_IN_GA(T21, X8)
PB_IN_GA(f(T38), X37) → PA_IN_GAA(T38, X35, X36)

R is empty.
The argument filtering Pi contains the following mapping:
f(x1)  =  f(x1)
PA_IN_GAA(x1, x2, x3)  =  PA_IN_GAA(x1)
PB_IN_GA(x1, x2)  =  PB_IN_GA(x1)

We have to consider all (P,R,Pi)-chains

(11) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(12) Obligation:

Q DP problem:
The TRS P consists of the following rules:

PA_IN_GAA(T21) → PB_IN_GA(T21)
PB_IN_GA(f(T38)) → PA_IN_GAA(T38)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(13) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • PB_IN_GA(f(T38)) → PA_IN_GAA(T38)
    The graph contains the following edges 1 > 1

  • PA_IN_GAA(T21) → PB_IN_GA(T21)
    The graph contains the following edges 1 >= 1

(14) YES